export const state = () => {
    return {
        data: [],
    }
}
export const mutations = {
    SET_LIST(state, v) {
        state.data = v.data
    },

}

export const actions = {
    async getData({ commit }, row) {
        if (row) {
            const { data } = await this.$axios.get(`http://localhost:3001/classify/classify-list?pageSize=${row.pageSize}&sortBy=true`)
            commit('SET_LIST', data)
        } else {
            const { data } = await this.$axios.get('http://localhost:3001/classify/classify-list?pageSize=10&sortBy=true')
            commit('SET_LIST', data)
        }
    },
    async addData({ }, row) {
        console.log(row)
        const r = await this.$axios.post('http://localhost:3001/classify/save-classify', row)
        console.log(r)
    },
    async editData({ }, row) {
        await this.$axios.post('http://localhost:3001/classify/update-classify', row)
    },
    async delData({ }, row) {
        console.log(row)
        await this.$axios.get(`http://localhost:3001/classify/delete-classify?id=${row}`)
    }
}

export const getters = {

}